package com.genreate.util.xyzw;

import java.util.List;
import java.util.Random;

// 吕布 - 无双乱舞 (主动技能)
class WuShuangLuanWu implements Skill {
    @Override
    public String getName() {
        return "无双乱舞";
    }

    @Override
    public void execute(Hero caster, List<Hero> targets) {
        System.out.println(caster.name + " 发动无双乱舞，对敌方全体造成伤害!");

        for (Hero target : targets) {
            if (target.isAlive) {
                int damage = caster.attack * 180 / 100; // 180%攻击力伤害

                if (caster.isCriticalHit()) {
                    float critMultiplier = caster.getCritDamageMultiplier();
                    damage *= critMultiplier;
                    System.out.println("暴击! 伤害倍率: " + critMultiplier);
                }

                target.takeDamage(caster, damage);

                // 50%几率附加沉默
                Random rand = new Random();
                if (rand.nextInt(100) < 50) {
                    target.applyControlEffect(ControlStatus.SILENCE, caster.controlAccuracy);
                }
            }
        }
    }
}
